package cn.com.winning.ecare.activity;

import cn.com.winning.ecare.common.MyApplication;
import android.app.ActivityGroup;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;

// 第一个标签页显示的Activity，继承ActivityGroup，管理所有子Activity
public class ShopMarket extends ActivityGroup
{
	// 用于管理本Group中的所有Activity
	public static ActivityGroup group;

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		MyApplication myApplication;
		myApplication = (MyApplication) getApplication();
		myApplication.addActivity(this);
		group = this;
	}

	@Override
	public void onBackPressed()
	{
		// 把后退事件交给子Activity处理
		group.getLocalActivityManager().getCurrentActivity().onBackPressed();
	}

	@Override
	protected void onResume()
	{
		super.onResume();
		// 要跳转的Activity
		Intent intent = new Intent(this, Shop1.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);;
		// 把Activity转换成一个Window，然后转换成View
		Window w = group.getLocalActivityManager().startActivity("Shop1", intent);
		View view = w.getDecorView();
		// 设置要跳转的Activity显示为本ActivityGroup的内容
		group.setContentView(view);

	}
}